package com.bwie.task;

import com.bwie.mapper.TbProdMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author 小薛超人
 * @version 1.0
 * @description: TODO
 * @date 2025/7/22 20:28
 */
@Component
public class ProdTask {
    @Autowired
    TbProdMapper tbProdMapper;

    //每分钟检查一次上架
    @Scheduled(cron = "0 0/1  * * * ?")
    public void uploadProdTask(){
        System.out.println("开始执行定时上架任务");
        tbProdMapper.taskUploadProd();
        System.out.println("结束执行定时上架任务");

    }
    //每分钟检查一次下架
    @Scheduled(cron = "0 0/1  * * * ?")
    public void offlineProdTask(){
        System.out.println("开始执行定时下架任务");
        tbProdMapper.taskofflineProd();
        System.out.println("结束执行定时下架任务");
    }
}
